package com.iwhalecloud.bss.kite.cucc.service.custview.userinfo.supplier;

import com.iwhalecloud.bss.kite.cucc.client.vo.custview.CustViewAttr;
import com.iwhalecloud.bss.kite.cucc.service.custview.userinfo.UserInfoContext;

/**
 * @ClassName : AbstractUserAttrSupplier
 * @Description : 用户信息属性提供者抽象类
 * @Author : xie.zhengjun
 * @Date : 2021/3/13 17:53
 */
public abstract class AbstractUserAttrSupplier {
    protected UserInfoContext userInfoContext;

    public CustViewAttr get() {
        CustViewAttr custViewAttr = new CustViewAttr();
        custViewAttr.setCode(userInfoContext.getAttrCode());
        custViewAttr.setName(userInfoContext.getAttrName());
        custViewAttr.setOrderId(userInfoContext.getAttrOrder());
        custViewAttr.setValue(getValue());
        custViewAttr.setValueDesc(getValueDesc());
        return custViewAttr;
    }

    /**
     * 获取属性值，子类必须覆盖实现
     *
     * @return 属性值
     */
    public abstract String getValue();

    /**
     * 获取翻译值，默认为属性值，子类可覆盖
     *
     * @return 翻译值
     */
    public String getValueDesc() {
        return getValue();
    }

    public UserInfoContext getUserInfoContext() {
        return userInfoContext;
    }

    public void setUserInfoContext(UserInfoContext userInfoContext) {
        this.userInfoContext = userInfoContext;
    }
}
